package com.google.googlemarket.adapter;

import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.Fragment;

import com.google.googlemarket.base.BaseFragment;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by MrGao on 2017/9/17.
 */

public class MyAdpter extends FragmentPagerAdapter {
    private final ArrayList<Fragment> mFragment;

    public MyAdpter(FragmentManager fm, ArrayList<Fragment> mFragments) {
        super(fm);
        this.mFragment=mFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragment.get(position);
    }

    @Override
    public int getCount() {
        return mFragment.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        BaseFragment fragment = (BaseFragment) mFragment.get(position);
        return fragment.getTitle();
    }
}
